home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROGS.ZIP / ISTRIP.ICN < prev    next >
Text File  |  1992-09-28  |  1KB  |  40 lines

  1. ############################################################################
  2. #
  3. #    File:     istrip.icn
  4. #
  5. #    Subject:  Program to strip comments from Icon program
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     March 29, 1992
  10. #
  11. ###########################################################################
  12. #
  13. #  This program strips comments out of an Icon program. It also removes
  14. #  empty lines and leading whitespace (see stripcom.icn).
  15. #
  16. ############################################################################
  17. #
  18. #  Links:  stripcom
  19. #
  20. ############################################################################
  21.  
  22. link stripcom
  23.  
  24. procedure main()
  25.    local line, nextline
  26.  
  27.    while line := read() do {
  28.       while line[-1] == "_" do {    # handle continued literal
  29.          nextline := read() | stop("*** unclosed continued literal")
  30.          nextline ?:= {
  31.             tab(many(' \t'))        # remove leading whitespace
  32.             tab(0)
  33.             }
  34.          line := line[1:-1] || nextline
  35.          }
  36.       write(stripcom(line))
  37.       }
  38.  
  39. end
  40.